package com.akino.gulimall.order.service;

import com.akino.common.to.mq.SeckillOrderTo;
import com.akino.gulimall.order.vo.OrderConfirmVo;
import com.akino.gulimall.order.vo.OrderSubmitVo;
import com.akino.gulimall.order.vo.SubmitOrderResponseVo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.akino.common.utils.PageUtils;
import com.akino.gulimall.order.entity.OrderEntity;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author akino
 * @email akino@gmail.com
 * @date 2022-02-08 20:07:51
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 订单确认页面返回需要用的数据
     */
    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    /**
     * 下单：创建订单，验证令牌，验证价格，锁库存
     */
    SubmitOrderResponseVo submitOrder(OrderSubmitVo submitVo);

    /**
     * 根据订单号查询订单状态
     */
    OrderEntity getOrderByOrderSn(String orderSn);

    /**
     * 关闭订单
     * @param entity
     */
    void closeOrder(OrderEntity entity);

    /**
     * 创建秒杀订单
     * @param seckillOrder 要创建的秒杀订单相关参数
     */
    void createSeckillOrder(SeckillOrderTo seckillOrder);
}

